using System.Security.Claims;

namespace UniversalAdmin.Application.Services
{
    /// <summary>
    /// JWT 服务接口
    /// </summary>
    public interface IJwtService
    {
        /// <summary>
        /// 生成访问令牌
        /// </summary>
        string GenerateAccessToken(int userId, string username, IEnumerable<string> roles);

        /// <summary>
        /// 生成刷新令牌
        /// </summary>
        string GenerateRefreshToken();

        /// <summary>
        /// 验证令牌
        /// </summary>
        bool ValidateToken(string token);

        /// <summary>
        /// 从令牌中获取用户信息
        /// </summary>
        ClaimsPrincipal? GetPrincipalFromToken(string token);

        /// <summary>
        /// 从过期的访问令牌中获取用户信息（用于刷新Token）
        /// </summary>
        ClaimsPrincipal? GetPrincipalFromExpiredToken(string token);

        /// <summary>
        /// 验证刷新令牌格式
        /// </summary>
        bool ValidateRefreshToken(string refreshToken);
    }
}
